import React from 'react'

class Bottom extends React.Component{
    constructor(props){
        super(props);
        this.state={
            list: ['1','2']
        }
    }
    render(){
        return (
            <ul>
                {
                    this.state.list.map((value,index) => {
                        return <li onClick={this.handleDelItem.bind(this,index)} key={index}>{value}</li>
                    })
                }
            </ul>
        )
    }
    handleDelItem(index){
        this.setState((prevState)=>{
            const list = [...prevState.list];
            list.splice(index,1);
            return {list}
        });
    }
}
export default Bottom;